(function (window, $, undefined) {
  'use strict';

  main(function () {

    var $tableAccount = $('#table-account');
    util.jqGrid($tableAccount, {
      url: '/json/test.json',
      datatype: 'json',
      autowidth: true,
      height: $(window).height() - 320,
      multiselect: true,
      multiboxonly: true,
      // shrinkToFit: false,
      colModel: [
        { name: '_id', key: true, hidden: true },
        { label: '姓名', name: '', width: 100 },
        { label: '电话', name: '', width: 100 },
        { label: '地址', name: '', width: 100 },
        { label: '职权', name: '', width: 120 },
        { label: '操作', name: '', width: 150 }
      ],
      pager: '#pager-account'
    });

    // panes
    $('#pane1').click(function () {
      setTab(1,3);
    });

    $('#pane2').click(function () {
      setTab(2,3);
    });

    $('#pane3').click(function () {
      setTab(3,3);
    });

    function setTab(cursel, n) {
      for(var i=1;i<=n;i++){
        var s = "#pane" + i;
        var c = "#content" + i;
        if(i==cursel) {
          $(s).attr('class','tab-pane-selected');
          $(c).css("display","block");
        }
        else{
          $(s).attr('class','tab-pane');
          $(c).css("display","none");
        }
      }
    }

  });


})(window, jQuery);
